-
Notifications
You must be signed in to change notification settings - Fork 230
More robust sample testing python #300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
}' \ | ||
--return-values NONE | ||
|
||
# Delete all tables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we delete commented out code?
if aws kinesis create-stream --stream-name $STREAM_NAME --shard-count 1; then | ||
break | ||
else | ||
echo "Stream creation failed, attempt $i/10. Waiting $((i * 3)) seconds..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we scale like this for sleeping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simple retry wasn't thorough enough but an exponential backoff was a bit overkill, I found that linear backoff was a good in-between point
#!/bin/bash | ||
set -e | ||
|
||
LEASE_EXISTS=$(aws dynamodb scan --table-name $APP_NAME --select "COUNT" --query "Count" --output text || echo "0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: NUM_LEASES_FOUND
set -e | ||
|
||
LEASE_EXISTS=$(aws dynamodb scan --table-name $APP_NAME --select "COUNT" --query "Count" --output text || echo "0") | ||
CHECKPOINT_EXISTS=$(aws dynamodb scan --table-name $APP_NAME --select "COUNT" --filter-expression "attribute_exists(checkpoint) AND checkpoint <> :trim_horizon" --expression-attribute-values '{":trim_horizon": {"S": "TRIM_HORIZON"}}' --query "Count" --output text || echo "0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: NUM_CHECKPOINTS_FOUND
.github/workflows/python.yml
Outdated
PR_URL: ${{github.event.pull_request.html_url}} | ||
GH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
||
# # update permissions to 'contents: write' when enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets remove unused code if its not planned to be in use.
APP_NAME: ${{ env.APP_NAME }} | ||
|
||
# Clean up all existing Streams and DDB tables | ||
- name: Clean up Kinesis Stream and DynamoDB table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a scenario where this may not run or the job fails out before this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, even if the job fails out before this point the if:always()
makes sure this step always runs
#!/bin/bash | ||
set -e | ||
|
||
# Manipulate sample.properties file that the KCL application pulls properties from (ex: streamName, applicationName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Manipulate sample.properties file that the KCL application pulls properties from (ex: streamName, applicationName)
sed -i "" "s/kclpysample/$STREAM_NAME/g" samples/sample.properties
sed -i "" "s/PythonKCLSample/$APP_NAME/g" samples/sample.properties
sed -i "" 's/us-east-5/us-east-1/g' samples/sample.properties
# Depending on the OS, different properties need to be changed
if [[ "$RUNNER_OS" == "macOS" ]]; then
grep -v "idleTimeBetweenReadsInMillis" samples/sample.properties > samples/temp.properties
echo "idleTimeBetweenReadsInMillis = 250" >> samples/temp.properties
mv samples/temp.properties samples/sample.properties
elif [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "Windows" ]]; then
sed -i "/idleTimeBetweenReadsInMillis/c\idleTimeBetweenReadsInMillis = 250" samples/sample.properties
...
Issue #, if available:
Description of changes:
Added more robust checks for kcl functionality.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.